# Forked from Alpine to add systemd!

pkgname=kscreenlocker
pkgver=99996.2.5
_pkgver=6.2.5
pkgrel=0
pkgdesc="Library and components for secure lock screen architecture"
# armhf blocked by extra-cmake-modules
arch="all !armhf !armv7"
url="https://kde.org/plasma-desktop/"
license="GPL-2.0-or-later AND (GPL-2.0-only OR GPL-3.0-only)"
depends="linux-pam"
depends_dev="
	kcmutils-dev
	kcrash-dev
	kdeclarative-dev
	kglobalaccel-dev
	ki18n-dev
	kidletime-dev
	knotifications-dev
	ksvg-dev
	ktextwidgets-dev
	kwayland-dev
	kwindowsystem-dev
	kxmlgui-dev
	layer-shell-qt-dev
	libkscreen-dev
	libplasma-dev
	libseccomp-dev
	linux-pam-dev
	qt6-qtbase-dev
	solid-dev
	systemd-dev
	xcb-util-keysyms-dev
	"
makedepends="
	$depends_dev
	extra-cmake-modules
	samurai
	"
checkdepends="xvfb-run"

case "$_pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
_repo_url="https://invent.kde.org/plasma/kscreenlocker.git"
source="https://download.kde.org/$_rel/plasma/$_pkgver/kscreenlocker-$_pkgver.tar.xz
	kde.pam
	kde-fingerprint.pam
	kde-smartcard.pam
	"
subpackages="$pkgname-dev $pkgname-lang"
options="!check" # Requires running loginctl
builddir="$srcdir/$pkgname-$_pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	xvfb-run ctest --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -D -m644 "$srcdir"/kde.pam "$pkgdir"/etc/pam.d/kde
	install -m644 "$srcdir"/kde-fingerprint.pam "$pkgdir"/etc/pam.d/kde-fingerprint
	install -m644 "$srcdir"/kde-smartcard.pam "$pkgdir"/etc/pam.d/kde-smartcard
}

sha512sums="
6c340388bd47298915160497e9fd7d9b5ae0d75edd059e5d7ecf47ae13f0acc7e2726e674deb06c0aaff0eff7d91542ad3297fb09aa087b3f7a24ce6721c7edc  kscreenlocker-6.2.5.tar.xz
cdbc45fb74a3c43fb2302fe09bf2f9f644ca93693e0110cf748c403762236aaeea8284a8d21fc495014c69b6d5fe4789aaff7687ce9f03dda270490fa5042e2b  kde.pam
fe2f244b73b5cccf4b7125b9e3cac0a35566840e4ba2f69937fd8053aa56af71ee43dcbfa9c0f79de9ebe31f656e98a5d38955f77560be5c3535b08215ad8789  kde-fingerprint.pam
2ae866d25224ba345ea9d5ddb2fce668de5c51d1cfbb4d7a048c50107ccd6cffc3231a46855599c0ba3d62ff002a26e45b69d9029f88f4ab42661465a5e526c5  kde-smartcard.pam
"
